import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { UploadImg } from '/@/components/UploadImg/index';

export function formSchemaCommercial(modeType: number, uploadFileRecord: any): FormSchema[] {
  const res: FormSchema[] = [
    {
      label: '场所名称',
      field: 'placeName',
      component: 'Input',
      required: true,
    },
    {
      label: '经营面积',
      field: 'businessArea',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '联系方式',
      field: 'contact',
      component: 'Input',
      required: true,
    },
    {
      label: '具体用途',
      field: '_specificPurpose',
      component: 'CheckboxGroup',
      componentProps: {
        options: [
          {
            label: '餐饮饭店',
            value: '餐饮饭店',
          },
          {
            label: '民宿宾馆',
            value: '民宿宾馆',
          },
          {
            label: '批发零售',
            value: '批发零售',
          },
          {
            label: '休闲娱乐',
            value: '休闲娱乐',
          },
          {
            label: '教育培训',
            value: '教育培训',
          },
          {
            label: '医疗卫生',
            value: '医疗卫生',
          },
          {
            label: '养老服务',
            value: '养老服务',
          },
          {
            label: '生产加工',
            value: '生产加工',
          },
          {
            label: '仓储物流',
            value: '仓储物流',
          },
          {
            label: '宗教场所',
            value: '宗教场所',
          },
          {
            label: '商务办公',
            value: '商务办公',
          },
          {
            label: '农贸市场',
            value: '农贸市场',
          },
          {
            label: '其他',
            value: '其他',
          },
        ],
      },
      required: true,
    },
    {
      label: '建筑现有疏散楼梯数量(个)',
      field: 'escapeStairsNum',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '建筑首层现有安全出口数量(个)',
      field: 'firstExitNum',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '建筑首层面积(平方米)',
      field: 'firstFloorArea',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '建筑设置联网型独立感烟报警器数(个)',
      field: 'smokeAlarmNum',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '建筑设有简易喷淋灭火系统数(套)',
      field: 'simpleSprinklerSystemNum',
      component: 'InputNumber',
      required: true,
    },
    {
      label:
        '电动自行车、电动平衡车及其蓄电池在房屋公共区域、疏散走道、楼梯间、安全出口或房间内停放、充电',
      field: 'useElectricBicycle',
      component: 'Checkbox',
      defaultValue: false,
    },
    {
      label: '照片',
      field: 'useElectricBicyclePhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '出租房屋的公共区域、租住房间内、地下室、半地下室使用瓶装液化石油气',
      field: 'useBottledLiquefiedGas',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useBottledLiquefiedGasPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '疏散走道、楼梯间、安全出口处堆放物品影响人员疏散',
      field: 'useStackedItems',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useStackedItemsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '外窗、疏散走道安装防盗网、广告牌、铁栅栏等影响逃生和灭火救援的障碍物',
      field: 'useBurglarMesh',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useBurglarMeshPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '供人员疏散的场院、内院、天井设置不利于烟气扩散的顶棚、雨棚等',
      field: 'useCeiling',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useCeilingPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label:
        '居住区域与生产、经营、存储区域未使用实体砖墙、防火门等进行完全分隔，同时居住区域未设置直通室外的独立疏散楼梯、安全出口',
      field: 'isCompletelyIsolated',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'isCompletelyIsolatedPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '屋顶、围护结构、房间隔墙使用易燃可燃夹芯彩钢板搭建，疏散通道使用易燃可燃材料装修',
      field: 'useFlammableMaterials',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useFlammableMaterialsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '在供电设施上擅自接线用电，擅自在导线上接用电器设备',
      field: 'unauthorizedElectricalConnect',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'unauthorizedElectricalConnectPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    //456
    {
      label: '疏散通道或安全出口数量不足或严重堵塞',
      field: 'notEnoughExits',
      component: 'Checkbox',
    },

    {
      label: '照片',
      field: 'fireServiceDamagedPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    //123
    {
      label: '建筑消防设施严重损坏',
      field: 'fireServiceDamaged',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'notEnoughExitsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '人员密集场所违规使用、储存易燃易爆危险品',
      field: 'useStoreDangerousGoods',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useStoreDangerousGoodsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '其他可能严重威胁公共安全的火灾隐患',
      field: 'threatenSafetyFireHazards',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'threatenSafetyFireHazardsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '采用易燃燃保温材料的冷库、设置液氮制冷剂的冷库的自建房设置居住场所（栋）',
      field: 'useFlammableInsulationMaterials',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useFlammableInsulationMaterialsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '生产、储存、经营易燃易爆危险品的自建房设置居住场所（栋）',
      field: 'useFlammableDangerousGoods',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useFlammableDangerousGoodsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '3层及3层以上建筑是否仅房主自住使用',
      field: 'aboveThreeFloorSelf',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'aboveThreeFloorSelfPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        !values[field.substring(0, field.length - 'Photos'.length)],
    },


    {
      label: '本次核查意见',
      field: 'checkMind',
      component: 'InputTextArea',
      show: () => modeType == 1,
    },
    {
      label: '核查照片',
      field: 'checkPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 10,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: () => modeType == 1,
    },
  ];

  return res;
}

export function formSchemaResident(modeType: number, uploadFileRecord: any): FormSchema[] {
  const res: FormSchema[] = [
    {
      label: '场所名称',
      field: 'placeName',
      component: 'Input',
      required: true,
    },
    {
      label: '户主姓名',
      field: 'householder',
      component: 'Input',
      required: true,
    },
    {
      label: '联系方式',
      field: 'contact',
      component: 'Input',
      required: true,
    },
    {
      label: '可居住人口数',
      field: 'maxPopulation',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '建筑层数',
      field: 'buildingFloors',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '出租房间数',
      field: 'leaseRooms',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '出租房间居住人数',
      field: 'leaseRoomPeoples',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '建筑现有疏散楼梯数量(个)',
      field: 'escapeStairsNum',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '建筑首层现有安全出口数量(个)',
      field: 'firstExitNum',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '建筑首层面积(平方米)',
      field: 'firstFloorArea',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '建筑设置联网型独立感烟报警器数(个)',
      field: 'smokeAlarmNum',
      component: 'InputNumber',
      required: true,
    },
    {
      label: '建筑设有简易喷淋灭火系统数(套)',
      field: 'simpleSprinklerSystemNum',
      component: 'InputNumber',
      required: true,
    },
    {
      label:
        '电动自行车、电动平衡车及其蓄电池在房屋公共区域、疏散走道、楼梯间、安全出口或房间内停放、充电',
      field: 'useElectricBicycle',
      component: 'Checkbox',
      defaultValue: false,
    },
    {
      label: '照片',
      field: 'useElectricBicyclePhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '出租房屋的公共区域、租住房间内、地下室、半地下室使用瓶装液化石油气',
      field: 'useBottledLiquefiedGas',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useBottledLiquefiedGasPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '疏散走道、楼梯间、安全出口处堆放物品影响人员疏散',
      field: 'useStackedItems',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useStackedItemsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '外窗、疏散走道安装防盗网、广告牌、铁栅栏等影响逃生和灭火救援的障碍物',
      field: 'useBurglarMesh',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useBurglarMeshPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '供人员疏散的场院、内院、天井设置不利于烟气扩散的顶棚、雨棚等',
      field: 'useCeiling',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useCeilingPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label:
        '居住区域与生产、经营、存储区域未使用实体砖墙、防火门等进行完全分隔，同时居住区域未设置直通室外的独立疏散楼梯、安全出口',
      field: 'isCompletelyIsolated',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'isCompletelyIsolatedPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '屋顶、围护结构、房间隔墙使用易燃可燃夹芯彩钢板搭建，疏散通道使用易燃可燃材料装修',
      field: 'useFlammableMaterials',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useFlammableMaterialsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '在供电设施上擅自接线用电，擅自在导线上接用电器设备',
      field: 'unauthorizedElectricalConnect',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'unauthorizedElectricalConnectPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '电动自行车集中充电设施未按照农村地区电动自行车集中充电设施建设指引要求建设或整改',
      field: 'chargingFacilitiesNoStandard',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'chargingFacilitiesNoStandardPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '出租房屋3层及以上出租住人，且不满足2部疏散楼梯和首层2个安全出口',
      field: 'notEnoughExits',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'notEnoughExitsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '采用易燃燃保温材料的冷库、设置液氮制冷剂的冷库的自建房设置居住场所（栋）',
      field: 'useFlammableInsulationMaterials',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useFlammableInsulationMaterialsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '生产、储存、经营易燃易爆危险品的自建房设置居住场所（栋）',
      field: 'useFlammableDangerousGoods',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useFlammableDangerousGoodsPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '3层及3层以上建筑是否仅房主自住使用',
      field: 'aboveThreeFloorSelf',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'aboveThreeFloorSelfPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        !values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '所有自建房出租房间是否设置联网型独立感烟报警器，以及简易喷淋灭火系统',
      field: 'useIndependentSmokeAlarm',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'useIndependentSmokeAlarmPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        !values[field.substring(0, field.length - 'Photos'.length)],
    },
    {
      label: '3层及以上全部房间是否配备逃生绳、配备灭火器',
      field: 'aboveThreeFloorsEscape',
      component: 'Checkbox',
    },
    {
      label: '照片',
      field: 'aboveThreeFloorsEscapePhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 2,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: ({ schema, values, model, field }) =>
        !values[field.substring(0, field.length - 'Photos'.length)],
    },

    {
      label: '本次核查意见',
      field: 'checkMind',
      component: 'InputTextArea',
      show: () => modeType == 1,
    },
    {
      label: '核查照片',
      field: 'checkPhotos',
      component: 'Input',
      render: ({ schema, values, model, field }) => {
        return h(UploadImg, {
          picList: values[field],
          maxPic: 10,
          onChange: (fileList) => {
            uploadFileRecord[field] = fileList;
          },
        });
      },
      show: () => modeType == 1,
    },
  ];

  return res;
}
